package Game;

import java.awt.*;
import java.util.Iterator;

/**
 * Represents the abstract idea of a sprite object.
 * 
 * @author YQ
 */
public abstract class AbstractSprite
{
	protected Image myImage;
	protected Point myVelocity;
	protected int myLives;
	protected Point myPosition;
	protected boolean myMobility;
	protected String myType;
	protected java.util.ArrayList<AbstractBehavior> myBehaviors;
	
	public AbstractSprite(Point position)
	{
		this(position, new Point(0,0));
	}
	
	public AbstractSprite(Point position, Point velocity)
	{
		this(position, velocity, 1);
	}
	
	public AbstractSprite(Point position, Point velocity, int lives)
	{
		myPosition = position;
		myVelocity = velocity;
		myLives = lives;
	}
	
	public void updateImage( Image image )
	{
		myImage = image;
	}
	
	public Image getImage()
	{
		return( myImage );
	}
	
	public Point getVelocity()
	{
		return( myVelocity );
	}
	
	public int getLives()
	{
		return( myLives );
	}
	
	public Point getPosition()
	{
		return( myPosition );
	}
	
	public boolean getMobility()
	{
		return( myMobility );
	}
	
	public String getType()
	{
		return( myType );
	}
	
	public java.util.Collection<AbstractBehavior> getBehaviors()
	{
		return myBehaviors;
	}
	
	public void add(AbstractBehavior b)
	{
		myBehaviors.add(b);
	}
	
	public void setImage( Image image )
	{
		myImage = image;
	}
	
	public void setVelocity( Point velocity )
	{
		myVelocity = velocity;
	}
	
	public void setLives( int lives )
	{
		myLives = lives;
	}
	
	public void setPosition( Point position )
	{
		myPosition = position;
	}
	
	public void setMobility( boolean mobility )
	{
		myMobility = mobility;
	}
	
	/**
	 * Determines what a sprite should do if another sprite collides with it.
	 * 
	 * @param sprite the sprite that collides with this sprite
	 */
	public abstract void collisionReaction( AbstractSprite sprite );
}